<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html" xmlns:t="http://myfaces.apache.org/tomahawk"
     template="../template_back.xhtml">
  
  <ui:define name="content">
  
<h:form enctype="multipart/form-data">
	
	    <h:outputText value="Titre livre" />
        <p:inputText id="title" value="#{bookController.currentBook.title}" required="true" />
        <h:message for="title"></h:message>
     	<br/>
        <h:outputText value="Prix livre" />
        <p:inputText id="price" value="#{bookController.currentBook.price}" required="true" />
        <h:message for="price"></h:message>
		<br/>
        <h:outputText value="Liste categories " />        
		<p:selectOneMenu value="#{bookController.currentBook.category}" converter="#{categoryConverter}">
		    <f:selectItems value="#{categoryController.categories}" var="cat" itemValue="#{cat}" itemLabel="#{cat.title}" />
		</p:selectOneMenu>
		<br/>
		<h:outputText value="Auteurs" />  
		<p:selectManyMenu  id="scroll" value="#{bookController.tempAuthor}" converter="#{authorConverter}" style="width:150px;height:200px" var="p" showCheckbox="true">  >
			<f:selectItems value="#{authorController.authors}" var="aut" itemValue="#{aut}" itemLabel="#{aut.firstName}" />
			
			<p:column>  
                #{p.firstName} 
            </p:column>  
            
		</p:selectManyMenu>


				<p:fileUpload value="#{bookController.file}" mode="simple" />
		<br/>
      <h:commandButton action="#{bookController.addBook}" value="Ajouter livre"/> 
      
      <h:messages globalOnly="true"/>
      
 <p:dialog id="dialog" header="Selected Values" modal="true" showEffect="fade" hideEffect="fade" widgetVar="dlg">  
        <p:outputPanel id="display">  
            <p:dataList id="selectedPlayers" value="#{bookController.tempAuthor}" var="p">  
                #{p.firstName}  
            </p:dataList>  
        </p:outputPanel>  
    </p:dialog>  
       
    
</h:form> 

    
  </ui:define>
  
</ui:composition>
